package main

import (
	"fmt"
)

func testSlice(s1 []int) {
	s1 = append(s1, 10000)
}

func main() {
	array := make([]int, 2, 5)
	fmt.Println(array)

	array2 := [5]int{1, 2, 3}
	fmt.Println(array2)
	fmt.Printf("%T\n", array2)
	//copy(array, []int{1, 2, 3})
	copy(array, array2[:])

	fmt.Println(array, cap(array))

	// -------------------------------
	fmt.Println("-----------------------")
	array3 := [...]int{0, 1, 2, 3, 4, 5, 6, 7}
	fmt.Println(len(array3), cap(array3))
	array4 := array3[2:6]
	array5 := array4[3:5]
	fmt.Println(array4, array5)

	//array4 = append(array4, 100, 1000)
	//fmt.Println(array4, array3)
	array4 = array4[:cap(array4)]
	fmt.Println(array4, len(array4), cap(array4), array5)
	//array4 = array4[:]
	//fmt.Println(array4, len(array4), cap(array4), array5)

	// -------------------------------
	fmt.Println("-----------------------")
	s1 := []int{0, 1, 2, 3, 4, 5}
	fmt.Println(s1, len(s1), cap(s1))
	testSlice(s1)
	fmt.Println(s1, len(s1), cap(s1))

}
